<%@ page import="Contas.Administrador" %>
<%@ page import="Contas.Telefone" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="adminContas" />
        <g:set var="entityName" value="${message(code: 'administrador.label', default: 'Administrador')}" />
        <title>SPL - Listando Administradores</title>
    </head>
    <body>
    
        <div class="body">
        
            <h1 align="center"><g:message code="Administradores do Sistema" /></h1>
            
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <div class="list">
                <table>
                    <thead>
                        <tr>
                        	<g:sortableColumn property="userRealName" title="${message(code: 'administrador.userRealName.label', default: 'Nome')}" />
                        	
                            <g:sortableColumn property="username" title="${message(code: 'administrador.username.label', default: 'Login')}" />
                                               
                            <g:sortableColumn property="email" title="${message(code: 'administrador.email.label', default: 'Email')}" />
                        
                            <g:sortableColumn property="telefone" title="${message(code: 'administrador.telefone.label', default: 'Telefone')}" />
                        	
                        	<g:sortableColumn property="tipo" title="${message(code: 'administrador.tipo.label', default: 'Tipo')}" />
                        	
                        	<g:sortableColumn property="description" title="Detalhes" />
                        
                        </tr>
                    </thead>
                    <tbody>
                    <g:each in="${administradorInstanceList}" status="i" var="administradorInstance">
                        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                        
                        	<td>${fieldValue(bean: administradorInstance, field: "userRealName")}</td>
                           
                            <td>${fieldValue(bean: administradorInstance, field: "username")}</td>
                                             
                            <td>${fieldValue(bean: administradorInstance, field: "email")}</td>
                            
                            <g:if test="${Contas.Telefone.get(administradorInstance.telefoneId) != null}">
                            	<td>${Contas.Telefone.get(administradorInstance.telefoneId).formatFone()}</td>
                            </g:if>
                        	<g:else>
 		                       	<td>${}</td>
                        	</g:else>
                            
                         
                            <td>${fieldValue(bean: administradorInstance, field: "tipo")}</td>
                            
                             <td class = "actionButtons">
                             
                             <span class = "actionButton">
                             
                            <g:link action="show" id="${administradorInstance.id}">
                              Ver mais
                            </g:link></span></td>

                        
                        </tr>
                    </g:each>
                    </tbody>
                </table>
            </div>
            <div class="paginateButtons">
                <g:paginate total="${administradorInstanceTotal}" />
            </div>
        </div>
    </body>
</html>
